package liu.db.procedure;

import static org.junit.Assert.*;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;

import org.junit.Test;

import liu.db.DBUtil;

public class GoodLuck {
	
	@Test
	public void testName() throws Exception {
		
		//获得链接
		Connection conn = DBUtil.getConn();
		//调用sql
		String sql="call good_pro(?,?,?)";
		
		CallableStatement cs = conn.prepareCall(sql);
		
		//设置入参
		cs.setString(1,"good");
		cs.setString(2,"luck");
		
		//注册出参
		cs.registerOutParameter(3,java.sql.Types.VARCHAR);
		
		//执行
		ResultSet rs = cs.executeQuery();
		String jg = cs.getString(3);
		System.out.println(jg);
		//关闭
		rs.close();
		cs.close();
		conn.close();
		
	}

}
